package com.klarna.raas.ws.dao.mapper;

import java.math.BigInteger;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

import com.klarna.raas.ws.domain.PersonInfo;

public class PersonResultsetExtractor implements ResultSetExtractor<PersonInfo> {

	public PersonInfo extractData(ResultSet rs) throws SQLException,
	DataAccessException {
		PersonInfo person = new PersonInfo();
		person.setId(new BigInteger(rs.getString(1)));
		person.setFirstName(rs.getString(3));
		person.setLastName(rs.getString(4));
		person.setStreet(rs.getString(5));
		person.setCity(rs.getString(6));
		person.setZip(rs.getString(7));
		person.setCareOf(rs.getString(8));
		person.setCountry(rs.getString(9));
		person.setBirthDate(rs.getString(11));

		return person;
	}
}
